﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace ProjectRoughWork
{
    class InputListener : EventListener
    {
        public InputListener()
            : base()
        {
        }

        /// <summary>
        /// Handles all input events
        /// </summary>
        /// <param name="eventData">Event to be processed</param>

        public override void VHandleEvent(IEventData eventData)
        {
            base.VHandleEvent(eventData);

            if (eventData.VGetEventType() == "KeyPressed")
            {
                //Handles Keyboard Input

                EventKeyPressed tempEvt = (EventKeyPressed)eventData;

                KeyboardState inputKey = tempEvt.getInput();

                //Sends Keyboard State to the Screen Manager to delegate it to the appropriate screen

                ScreenManager.GetInstance().HandleInput(inputKey);
            }
            else if (eventData.VGetEventType() == "MouseClicked")
            {
                //Handles Mouse Input

                EventMouseClicked tempEvt = (EventMouseClicked)eventData;

                MouseState inputClick = tempEvt.getInput();

                //Sends Mouse State to the Screen Manager to delegate it to the appropriate screen

                ScreenManager.GetInstance().HandleInput(inputClick);
            }
            else if (eventData.VGetEventType().Equals("ButtonPressed"))
            {
                EventButtonPressed tempEvt = (EventButtonPressed)eventData;

                GamePadState inputButton = tempEvt.InputButton;

                //Sends Mouse State to the Screen Manager to delegate it to the appropriate screen

                ScreenManager.GetInstance().HandleInput(inputButton);                
            }
        }


        //Add ScreenManager global variable?
    }
}
